<template>
  <div :class="['item_container',{'item_active':selectIndex===index}]"
  @click="onClick">
    <div>{{item.cname}}</div>
  </div>
</template>

<script>
export default {
  props:{
    item:{
      type:Object
    },
    selectIndex:Number,
    index:Number
  },
  methods:{
    onClick(){
      this.$emit("changeSelectIndex",this.index)
    }
  }
}
</script>

<style scoped>
.item_container
{
  width: 100%;
  height: 40px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.item_active
{
  color: red;
  border-left: 3px solid red;
}
</style>